﻿using Itech_Run.Blog.Application.Contracts.Dto;
using Itech_Run.Blog.Application.Contracts.Service;
using Itech_Run.HttpApi.Shared.Result;
using Itech_Run.HttpApi.Shared;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace Itech_Run.Blog.HttpApi.Controllers
{
    public class Front_BlogCommentController : BaseApiController
    {
        private readonly IFront_BlogCommentService _blogCommentService;
        public Front_BlogCommentController(IFront_BlogCommentService blogCommentService)
        {
            _blogCommentService = blogCommentService;
        }

        [AllowAnonymous]
        [HttpGet]
        public async Task<CustomResult> GetListAsync([FromQuery] Front_BlogCommentListDto listDto)
        {
            var result = await _blogCommentService.GetListAsync(listDto);
            return new CustomResult(result);
        }

        [AllowAnonymous]
        [HttpPost]
        public async Task<CustomResult> InsertAnonymousAsync(BlogCommentCreateDto dto)
        {
            await _blogCommentService.InsertAnonymousAsync(dto);
            return GetSuccesResult();
        }
    }
}
